# 8.为celery使用django配置文件进行设置
import os

if not os.getenv('DJANGO_SETTINGS_MODULE'):
    os.environ['DJANGO_SETTINGS_MODULE'] = 'mall.settings'

# 1.创建Celery对象
from celery import Celery

app = Celery('celery_tasks')

# 2.加载配置文件
app.config_from_object('celery_tasks.config')

# 7.设置celery自动加载任务
app.autodiscover_tasks(['celery_tasks.sms', 'celery_tasks.email','celery_tasks.html'])
